const koa = require("koa");
const bodyParser = require("koa-bodyparser");
const errHandle = require("./err.handle");
const userRouter = require("../router/users");

const app = new koa();

// 处理post参数解析中间件
app.use(bodyParser());
app.use(userRouter.routes()).use(userRouter.allowedMethods());

//错误处理
app.on("error", errHandle);
module.exports = app;
